<?php

namespace App\Http\Requests\OperationManagement;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\BaseRequest;

class IncinerationPlantRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'address' => 'required',
            'phone' => 'required|regex:/^1[345789][0-9]{9}$/',
            'principal' => 'required',
            'number' => 'required|integer',
            'servicing_time' => 'required',
            'end_time' => 'required'
        ];
    }

    public function messages() 
    {
        return [
            'name.required' => '名称不能为空',
            'address.required' => '地址不能为空',
            'phone.required' => '热线电话不能为空',
            'phone.regex' => '热线电话格式不合法',
            'principal.required' => '联系人不能为空',
            'number.required' => '日处理量不能为空',
            'number.integer' => '日处理量只能填写数字',
            'servicing_time.required' => '服务时间不能为空',
            'end_time.required' => '停运时间不能为空'
        ];
    }
}
